package com.zcl.javaCore;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @Description:
 * @author: zcl
 * @date: 2022/3/1  16:55
 */
public class CountLongWords {








    public static void main(String[] args) {

        List<String> names = Arrays.asList("张三", "李四", "王五", "赵柳", "张五六七", "王少", "赵四", "张仁", "李星");
        //需求：找出 姓张中名字最长的
        int maxLength = names.parallelStream()
                .filter(name -> name.startsWith("张"))
                .mapToInt(String::length)
                .max()
                .getAsInt();
        System.out.println(maxLength);

    }
}
